//add by yuanfei
#ifndef CCBREADER_H__
#define CCBREADER_H__
#include <map.h>
#include "cocos2d.h"
#include "CCBReader.h"
#include "CCNodeLoaderLibrary.h"
#include "CCBSelectorResolver.h"

using namespace cocos2d;
using namespace cocos2d::extension;
using namespace std;

typedef unsigned long long int UINT64;
class ButtonHandler : public CCObject{
public:
  static ButtonHandler *sharedButtonHandler();
  ButtonHandler();
  void handle(CCObject* pSender, CCControlEvent event);
  void menuHandle(CCObject* obj);
  void addName(const char* name, CCObject* sender);
private:
  static ButtonHandler* pSharedButtonHandler;
  map<void*, string> names_;
};


class MySelectorResolver : public CCBSelectorResolver{
public:
  ~MySelectorResolver();
  SEL_CCControlHandler  onResolveCCBCCControlSelector (CCObject *pTarget, CCString *pSelectorName);
  SEL_MenuHandler   onResolveCCBCCMenuItemSelector (CCObject *pTarget, CCString *pSelectorName);
};


int tolua_Cocos2d_CCBReader_load(lua_State* tolua_S);

int tolua_Cocos2d_CCButton_createWithFileName(lua_State* tolua_S);
int tolua_Cocos2d_CCButton_createWithFrameName(lua_State* tolua_S);
int tolua_Cocos2d_CCButton_setEnabled(lua_State* tolua_S);
int tolua_Cocos2d_CCButton_setTouchEndOnly(lua_State* tolua_S);
int tolua_Cocos2d_CCButton_setTitle(lua_State* tolua_S);
int tolua_Cocos2d_CCButton_setBackgroundImg(lua_State* tolua_S);

int tolua_Cocos2d_CCScrollView_setContainer(lua_State* tolua_S);
int tolua_Cocos2d_CCScrollView_getContainer(lua_State* tolua_S);
int tolua_Cocos2d_CCScrollView_getViewSize(lua_State* tolua_S);
int tolua_Cocos2d_CCScrollView_setContentOffset(lua_State* tolua_S);
int tolua_Cocos2d_CCScrollView_getContentOffset(lua_State* tolua_S);
#endif
